﻿//
//  ExitState
//
//  Created by Codyo on 2008-07-05.
//  Copyright (c) 2008 Codyo. All rights reserved.
//

import com.codyo.mobileStateMachine.MobileStateMachine;
import com.codyo.mobileStateMachine.AbstractState;

class com.codyo.states.ExitState extends AbstractState{

	private var stateMachine:MobileStateMachine;
	
	private var theStage:MovieClip;

	function ExitState(stateMachine:MobileStateMachine){
		this.stateMachine = stateMachine;
		trace("exit state entered");
	}
	
	public function keypadPressed(theKey:String):Void{
		theStage = this.stateMachine.getStage();
		switch(theKey){
			case "keySoft1":
				trace("EXIT - soft key 1 pressed");
				theStage.readout_txt.text = "EXIT - soft key 1 pressed";
				break;
			case "keySoft2":
				trace("EXIT - soft key 2 pressed");
				theStage.readout_txt.text = "EXIT - soft key 2 pressed";
				break;
			case "key1":
				trace("EXIT - key 1 pressed");
				theStage.readout_txt.text = "EXIT - key 1 pressed";
				break;
			case "key2":
				trace("EXIT - key 2 pressed");
				theStage.readout_txt.text = "EXIT - key 2 pressed";
				break;
			case "key3":
				trace("EXIT - key 3 pressed");
				theStage.readout_txt.text = "EXIT - key 3 pressed";
				stateMachine.setState(MobileStateMachine.ENTRY_STATE);
				break;
			default:
				trace("EXIT - key press not assigned");
				theStage.readout_txt.text = "EXIT - key not assigned pressed";
				break;
			
		}
	}
}